﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MathParserDemo;
using MathParserDemo.TokenizerExceptions;
namespace MathParserTest
{
    public partial class Main : Form
    {
        public Main()
        {
            InitializeComponent();
        }
        
        private void Form1_Load(object sender, EventArgs e)
        {
            
        }
        private void LnkTokenize_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            LstTokens.Items.Clear();
            List<Token> Tokens = new List<Token>();
            //try
            //{
                Tokens = Tokenizer.Tokenize(TxtExpression.Text);
            //}
            //catch (Exception Ex)
            //{
            //    LstTokens.Items.Add("Exception");
            //    LstTokens.Items[LstTokens.Items.Count-1].SubItems.Add(Ex.Message);
            //}
            foreach (Token T in Tokens)
            {
                LstTokens.Items.Add(T.TType.ToString());
                LstTokens.Items[LstTokens.Items.Count - 1].SubItems.Add(T.Value.ToString());
                LstTokens.Items[LstTokens.Items.Count - 1].SubItems.Add(T.Priority.ToString());
            }
        }
    }
}
